﻿#pragma once

#include "MirControl.h"
#include "../MirGraphics/MLibrary.h"
#include "../../tangible_event.h"

using namespace Client::MirGraphics;

namespace Client::MirControls
{
    class MirImageControl : public MirControl
    {
    public:
        virtual ~MirImageControl()
        {
            delete _library;
        }

        Point *getDisplayLocation() const override;
        Point *getDisplayLocationWithoutOffSet() const;

        #pragma region DrawImage
    private:
        bool _drawImage = false;
    public:
        bool getDrawImage() const;
        void setDrawImage(bool value);
        TangibleEvent<EventHandler> *DrawImageChanged = new TangibleEvent<EventHandler>();
    private:
        void OnDrawImageChanged();
        #pragma endregion

        #pragma region Index
        int _index = 0;
    public:
        virtual int getIndex() const;
        virtual void setIndex(int value);
        TangibleEvent<EventHandler> *IndexChanged = new TangibleEvent<EventHandler>();
    protected:
        void OnIndexChanged();
        #pragma endregion

        #pragma region Library
    private:
        MLibrary *_library;
    public:
        MLibrary *getLibrary() const;
        void setLibrary(MLibrary *value);
        TangibleEvent<EventHandler> *LibraryChanged = new TangibleEvent<EventHandler>();
    private:
        void OnLibraryChanged();
        #pragma endregion

        #pragma region PixelDetect
        bool _pixelDetect = false;
    protected:
        void setPixelDetect(bool value);
    public:
        TangibleEvent<EventHandler> *PixelDetectChanged = new TangibleEvent<EventHandler>();
    private:
        void OnPixelDetectChanged();
        #pragma endregion

        #pragma region UseOffset
        bool _useOffSet = false;
    public:
        protected:
        bool getUseOffSet() const;
        public:
        void setUseOffSet(bool value);
        TangibleEvent<EventHandler> *UseOffSetChanged = new TangibleEvent<EventHandler>();
    private:
        void OnUseOffSetChanged();
        #pragma endregion

        #pragma region Size
    public:
        void setSize(Size *value) override;
        Size *getSize() const override;

        Size *getTrueSize() const override;

        #pragma endregion

        MirImageControl();

    protected:
        void DrawControl() override;

    public:
        bool IsMouseOver(Point *p) override;

        #pragma region Disposable
    protected:
        void Dispose(bool disposing) override;
        #pragma endregion
    };
}
